package joe.beer;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TimePicker;

public class StartTimeActivity extends Activity {

	TimePicker tp;
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.starttime);

		tp = (TimePicker) findViewById(R.id.timePicker1);

		Button b = (Button) findViewById(R.id.button1);
		b.setOnClickListener(addListener);
	}

	// Create an anonymous implementation of OnClickListener
	private OnClickListener addListener = new OnClickListener() {
		public void onClick(View v) {
			finish();
		}
	};

	@Override
	public void finish() {
		Intent data = new Intent();
		data.putExtra("hour", tp.getCurrentHour());
		data.putExtra("minute", tp.getCurrentMinute());//textView.getText().toString());
		setResult(RESULT_OK, data);
		super.finish();
	}
}
